#!/bin/sh

SHOW_SPLASH=true
SPLASH_ARG=""
for arg in "$@"; do
  if [ "$arg" = "--splash=no" ]; then
    SHOW_SPLASH=false
  fi
done

SCDIR=/usr/share/jitsi

if $SHOW_SPLASH; then
  SPLASH_ARG="-splash:${SCDIR}/splash.gif"
fi

java \
  -cp "${SCDIR}/lib/*:${SCDIR}/config/" \
  --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED \
  --add-opens=java.base/java.lang=ALL-UNNAMED \
  ${SPLASH_ARG} \
  ${JITSI_EXTRA_ARGS} \
  net.java.sip.communicator.launcher.Jitsi
  "$@"
